<!--
 * @Author: wuheng wuheng@szhbzc.com
 * @Date: 2024-12-23 16:31:13
 * @LastEditors: wuheng wuheng@szhbzc.com
 * @LastEditTime: 2025-02-25 16:00:43
 * @FilePath: \web-appc:\Users\wuheng\Desktop\WugangNew\src\centerViews\dishmana\dishpricing\components\prcinfo.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="prcinformation">
    <div class="flex Box1">
      <div>
        <span>定价方式：</span><span class="spancolor">
          <span>{{
            getpricingTypetextFn(PricingData.pricingType) }}</span>
          {{ PricingData.pricingType == 'weight' ? '(' + PricingData.pricingTypeWeight
            + '元/50g)'
            : PricingData.pricingType == 'roi' ? '(' + PricingData.pricingTypeRoiRate + '%)' : ''
          }}</span>
      </div>
      <div>
        <span>定价权限：</span><span class="spancolor">{{ PricingData.pricingAuthorityType == 1 ? '自定义' : '中心定价' }}</span>
      </div>
    </div>
    <div class="flex">
      <div>
        <span>耗材成本：</span><span class="spancolor">{{ PricingData.conosumablesCost ? PricingData.conosumablesCost : 0
          }}元</span>
      </div>
      <div>
        <span>预估成本：</span><span>{{ PricingData.materialCost ? PricingData.materialCost : 0 }}元</span>
      </div>
    </div>
    <div class="flex Box2">
      <div>
        <span>实际售价：</span><span class="spancolor">{{ PricingData.sellPrice ? PricingData.sellPrice : 0 }}元</span>
      </div>
      <div>
        <span>预估售价：</span><span class="spancolor">{{ PricingData.estimatedSellPrice ? PricingData.estimatedSellPrice : 0
          }}元</span>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { GetDishPricingApi } from '@/api/Dashmana'
const props = defineProps({
  Bomdata: {
    type: Object,
    default: {}
  }
})
const getpricingTypetextFn = (status: any) => {
  if (status == 'weight') {
    return '按重量'
  } else if (status == 'roi') {
    return '按投产比'
  } else {
    return '按份'
  }
}
const PricingData = ref({} as any)
onMounted(() => {
  GetDishPricingApi({
    "dishCode": props.Bomdata.dishCode
  }).then((res) => {
    PricingData.value = res.data
  })
})
</script>

<style lang="scss" scoped>
.prcinformation {
  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.65);
  font-style: normal;
  text-transform: none;

  .Box1 {
    margin: 40px 0;
  }

  .Box2 {
    margin-top: 40px;
  }

  .spancolor {
    font-family: PingFang SC, PingFang SC;
    font-weight: 600;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.85);
    text-align: left;
    font-style: normal;
    text-transform: none;
  }

  >div>div {
    width: 250px;
  }
}
</style>
